package com.lifeng.client;

import com.lifeng.bean.User;
import com.lifeng.config.UserServiceFeignConfig;
import feign.Body;
import feign.Param;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;

/**
 * Created by lifeng on 2018/4/25.
 * UserServiceFeignConfig配置只作用于user-service-provider
 * 相关配置都可在UserServiceFeignConfig类中配置
 */
@FeignClient(name="user-service-provider",configuration = UserServiceFeignConfig.class)
public interface UserServiceFeignClient {
    @RequestLine(value = "GET /user/{id}")
    public User findById(@Param("id") String id);

    /**这种有问题服务方法收不到数据*/
    @RequestLine(value = "POST /user")
    @Body("id={id}&name={name}")
    public User save(@Param("id") String id, @Param("name")String name);
}
